#include<cstdio>
#include<queue>
#include<algorithm>
template<class T>void read(T &x)
{
	x=0;bool f=false;char ch=getchar();
	while(ch<'0'||ch>'9') { f|=(ch=='-'); ch=getchar(); }
	while(ch<='9'&&ch>='0') { x = (x<<1) + (x<<3) + (ch^48); ch=getchar(); }
	x = f ? -x : x;
	return ;
}

struct node{
	int x, y, color, cost;
	node(int xx, int yy, int col, int cst){x = xx; y = yy; color = col; cost = cst;}
};

std::queue<node>qu;
int cmap[110][110];
int map[110][110];
int n,m;

int main()
{
	int x,y,c;
	read(m);read(n);
	for(int i=1;i<=n;++i)
	{
		read(x);read(y);read(c);
		cmap[x][y] = c ? 1 : 2;
	}

	
}
